package com.hoas.quickstart.threads.chapter02.chapter02_3_3;

import java.util.Map;

public class Run {

    public static void main(String[] args) {

        RunThread thread = new RunThread();
        thread.start();

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();

        }

        thread.setRunning( false );

        System.out.println("已经赋值为false");

//        for (Map.Entry<Thread, StackTraceElement[]> stackTrace : Thread.getAllStackTraces().entrySet()) {
//            Thread thread1 = stackTrace.getKey();
//            StackTraceElement[] stack = stackTrace.getValue();
//            if (thread1.equals(Thread.currentThread())) {
//                continue;
//            }
//            System.out.println("\n线程：" + thread1.getName() + "\n");
//            for (StackTraceElement element : stack) {
//                System.out.println("\t" + element + "\n");
//            }
//            System.out.println();
//        }

    }

}
